package burubaka.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;

@Model(schemaVersion = 1)
public class MarkSheet implements Serializable {

	private static final long serialVersionUID = 1L;

	@Attribute(primaryKey = true)
	private Key key;

	@Attribute(version = true)
	private Long version;

	@Attribute(unindexed = true)
	private String betClass;
	@Attribute(unindexed = true)
	private String betClassName;
	@Attribute(unindexed = true)
	private String mark;
	@Attribute(unindexed = true)
	private String horseMark;
	@Attribute(unindexed = true)
	private long wager;
	@Attribute(unindexed = true)
	private long withdrawal = 0;// 投票額
	@Attribute(unindexed = true)
	private double withdrawalRate = 0;// 回収率
	@Attribute(unindexed = true)
	private int hitFlag = 0;

	/**
	 * Returns the key.
	 * 
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * Sets the key.
	 * 
	 * @param key
	 *            the key
	 */
	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * Returns the version.
	 * 
	 * @return the version
	 */
	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the version.
	 * 
	 * @param version
	 *            the version
	 */
	public void setVersion(Long version) {
		this.version = version;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	public String getBetClass() {
		return betClass;
	}

	public void setBetClass(String betClass) {
		this.betClass = betClass;
	}

	public String getBetClassName() {
		return betClassName;
	}

	public void setBetClassName(String betClassName) {
		this.betClassName = betClassName;
	}

	public String getMark() {
		return mark;
	}

	public void setMark(String mark) {
		this.mark = mark;
	}

	public String getHorseMark() {
		return horseMark;
	}

	public void setHorseMark(String horseMark) {
		this.horseMark = horseMark;
	}

	public long getWager() {
		return wager;
	}

	public void setWager(long wager) {
		this.wager = wager;
	}

	public long getWithdrawal() {
		return withdrawal;
	}

	public void setWithdrawal(long withdrawal) {
		this.withdrawal = withdrawal;
	}

	public double getWithdrawalRate() {
		return withdrawalRate;
	}

	public void setWithdrawalRate(double withdrawalRate) {
		this.withdrawalRate = withdrawalRate;
	}

	public int getHitFlag() {
		return hitFlag;
	}

	public void setHitFlag(int hitFlag) {
		this.hitFlag = hitFlag;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		MarkSheet other = (MarkSheet) obj;
		if (key == null) {
			if (other.key != null) {
				return false;
			}
		} else if (!key.equals(other.key)) {
			return false;
		}
		return true;
	}
}
